class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>>  vec;
        for(int i=1;i<=numRows;i++){
            vector<int> a;
            if(i==1){a.push_back(1);
                vec.push_back(a);
                continue;
            }
            
            for(int j=1;j<=i;j++){
                if(j==1|j==i)a.push_back(1);
                else a.push_back(vec[i-2][j-2]+vec[i-2][j-1]);
            }
            vec.push_back(a);
        }
        return vec;
    }
};
